/*!
 * \file frthrift_data_detect.c
 *
 * All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.\n
 *
 * \version 3.0
 * \author geyh
 * \date 2017/03/07
 *
 */

#include <CUnit/Basic.h>
#include <stdlib.h>
#include <json-c/json.h>

#include "frcomm.h"
#include "frmem.h"
#include "conntrack.h"
#include "frct_comm.h"
#include "frbyte_buffer.h"
#include "frreport_comm.h"
#include "../../../src/module/json/config.h"
#include "../../../src/module/json/json_data_analyze.h"
#include "../../../src/module/json/json_comm.h"
#include "../../../src/module/json/json_core.h"

#include "apmtest_cunit.h"
#include "apmtest_comm.h"

static int __suite_init(void)
{

    return 0;
}

static int __suite_cleanup(void)
{

    return 0;
}

static void case1(void)
{
    int i_ret = 0;

    i_ret = frthrift_data_detect(NULL);

    CU_ASSERT_EQUAL(i_ret, FR_NO);

}

static void case2(void)
{
    int i_ret = 0;
    char *p_data_in = (char *)"[1,\"sayHello\",1,1,{\"1\":{\"str\":\"Michael\"}}]";


    i_ret = frthrift_data_detect(p_data_in);

    CU_ASSERT_EQUAL(i_ret, FR_YES);

    return;
}



int add_suite_frthrift_data_detect(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" frthrift_data_detect()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    CU_add_test(pSuite, "case1", case1);
    CU_add_test(pSuite, "case2", case2);


    return FR_SUCC;

}